package com.orange.templatePatterns;


//抽象的支付类
public abstract class AbstructPayMent implements Payment{
    @Override
    public void pay(int amount) {
        //1日志记录
        log(amount);
        //2记录传入参数
        log(amount);
        //3发送消息给管理者
        sendMessageToManager();
        //3调用api去支付
        userApiToPay(amount);
        //8通知消费者
        sendMessageToUser();
    }

    //调用api进行支付
    public abstract void userApiToPay(int amount);

    private final void sendMessageToUser() {
        System.out.println("支付成功");
    }

    private final void sendMessageToManager() {
        System.out.println("开始支付");
    }


    public final void log(Integer amount){
        System.out.println("Pay " + amount + " yuan");
        System.out.println("Pay " + amount + " yuan");
        System.out.println("Pay " + amount + " yuan");
    }

    public final void logAttribute(Integer amount){
        System.out.println(amount);
        System.out.println(amount);
        System.out.println(amount);
        System.out.println(amount);
    }
}
